import random

# 写入模块
def modifl():
    with open('Data.txt','r+') as f:
        data_r=f.read().split()
    try:
        num=int(input('要写入几次:\n'))
    except:
        import os
        os.system('cls')
        input('数据输入错误...')
    for i in range(num):
        name=input('姓名:')
        for i in range(len(data_r)):
            data_n=eval(data_r[i])[1]
            if name==data_n:
                if 'yes'==input('是否合并(yes,no)'):
                    data_r[i]='"{}","{}","{}","{}","{}","{}","{}"'.format(data_r[i][0],name.split()[0],input('性别:').split()[0],input('年龄:').split()[0],input('身高(cm):')+'cm'.split()[0],input('体重(kg):')+'kg'.split()[0],input('班级(720):').split()[0])
                    for i in data_r:
                        with open('Data.txt','w') as f:
                            f.write(' {}'.format(i))
                else:
                    a='["{}",""{}"",""{}"","{}","{}","{}","{}"]'.format(hash(random.random()),name.split()[0],input('性别:').split()[0],input('年龄:').split()[0],input('身高(cm):')+'cm'.split()[0],input('体重(kg):')+'kg'.split()[0],input('班级(720):').split()[0])
                print('\n')
            else:
                a='["{}","{}","{}","{}","{}","{}","{}"]'.format(hash(random.random()),name.split()[0],input('性别:').split()[0],input('年龄:').split()[0],input('身高(cm):')+'cm'.split()[0],input('体重(kg):')+'kg'.split()[0],input('班级(720):').split()[0])
                with open('Data.txt','a') as f:
                    f.write(' {}'.format(a))
            break
